package com.jianbing.util;

import java.util.Random;

import com.jianbing.entity.Customer;

/**
 * Created by LFL on 2017/4/17
 */
public class AkasCreate {
	public static Customer create(Customer register) {
		Long timestamp = System.currentTimeMillis();
		String secret = rand();
		register.setAppKey(MD5Util.convert(Long.toString(timestamp)));
		register.setAppSecret(Sha1.convert(secret));
		return register;
	}

	public static String rand() {
		String random = "";
		Random rand = new Random();
		for (int i = 0; i < 13; i++) {
			/* 生成10以内的随机数，不含10，并转化为13位 */
			random += Integer.toString(rand.nextInt(10), 13);
		}
		return random;
	}
}
